/*
 * Directory_test.cc
 *
 *  Created on: 28 mrt. 2011
 *      Author: vincentvanandel
 */

#include "Inode.h"
#include <limits.h>
#include "FileSystem.h"
#include <gtest/gtest.h>

namespace {
// The fixture for testing class Foo.
class FileSystemTest : public ::testing::Test {

protected:
	FileSystem* filesys;
	OpenFile* file1;
	OpenFile* file2;
	OpenFile* file3;
  // You can remove any or all of the following functions if its body
  // is empty.

	virtual void SetUp() {
		 filesys = new FileSystem("File");
		 file1 = filesys->open("test1");
		 file2 = filesys->open("test2");
		 file3 = filesys->open("test3");
		 char buffer1[30];
		 char buffer2[30];
		 filesys->read(file1, buffer, 30);
	}

  virtual void TearDown() {
	  delete filesys;
	  delete file1;
	  delete file2;
	  delete file3;
  }

  // If the constructor and destructor are not enough for setting up
  // and cleaning up each test, you can define the following methods:

  // Objects declared here can be used by all tests in the test case for Foo.
};

TEST_F( FileSystemTest, TestRead ) {
	EXPECT_EQ( 23, filesys->read(file1, buffer1, 30); );
}

TEST_F( FileSystemTest, TestWrite ) {
	EXPECT_EQ( 23, filesys->write(file2, buffer2, 30););
}

TEST_F( FileSystemTest, Testlseek ) {
	EXPECT_EQ( 2, filesys->lseek(file3, 2 , SEEK_SET););
}

}

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

